package game.metalmax.packet.server {

	import flash.utils.ByteArray;
	
	import game.metalmax.packet.IPacket;
	import game.metalmax.packet.character.PHero;

//进入游戏响应
public class EnterGameResponse implements IPacket{

	//英雄列表
	public var heros:Array = null;
	private var _PHero0:PHero;
	//地图ID
	public var mapID:String;

	public function write(out:ByteArray):void{
		var len:int = 0;
		var i:int = 0;
		len = heros==null?0:heros.length;
		out.writeShort(len);
		for(i=0;i<len;i++){
			out.writeByte(heros[i]==null?0:1);
		if(heros[i]!=null) heros[i].write(out);
		}
		out.writeUTF(mapID==null?"":mapID);
	}
	public function read(inn:ByteArray):void{
		var len:int = 0;
		var i:int = 0;
		len = inn.readShort();
		if(len>0){
			heros = new Array();
			for(i=0;i<len;i++){
						if(inn.readByte() == 1){
heros[i]= new PHero();
heros[i].read(inn);
		}
			}
		}
		mapID = inn.readUTF();
}
}
}